# -*- coding: utf-8 -*-
# @Author : HaleShi
# @Time : 2023-06-16
# @File : 4_hook.py

import frida
import sys

str_host = "127.0.0.1:8877"
manager = frida.get_device_manager()
rdev = manager.add_remote_device(str_host)
session = rdev.attach("Momo")

scr = """
Java.perform(function () {
    var b = Java.use("com.immomo.momo.util.c.b");
    b.i.implementation = function(){
        var res = this.i()
        console.log("——————————————————————这是返回值",res);
        var now = new Date(); 
        var timestamp = now.getTime();
        console.log("——————————————————————这是当前时间",timestamp);
        return res
    };
    
});
"""

script = session.create_script(scr)


def on_message(message, data):
    print(message, data)


script.on("message", on_message)

script.load()
sys.stdin.read()